# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Solar.V1.Model.FinancedPurchaseSavings do
  @moduledoc """
  Cost and benefit of using a loan to buy a particular configuration of solar panels with a particular electricity usage.

  ## Attributes

  *   `annualLoanPayment` (*type:* `GoogleApi.Solar.V1.Model.Money.t`, *default:* `nil`) - Annual loan payments.
  *   `loanInterestRate` (*type:* `number()`, *default:* `nil`) - The interest rate on loans assumed in this set of calculations.
  *   `rebateValue` (*type:* `GoogleApi.Solar.V1.Model.Money.t`, *default:* `nil`) - The value of all tax rebates (including Federal Investment Tax Credit (ITC)).
  *   `savings` (*type:* `GoogleApi.Solar.V1.Model.SavingsOverTime.t`, *default:* `nil`) - How much is saved (or not) over the lifetime period.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annualLoanPayment => GoogleApi.Solar.V1.Model.Money.t() | nil,
          :loanInterestRate => number() | nil,
          :rebateValue => GoogleApi.Solar.V1.Model.Money.t() | nil,
          :savings => GoogleApi.Solar.V1.Model.SavingsOverTime.t() | nil
        }

  field(:annualLoanPayment, as: GoogleApi.Solar.V1.Model.Money)
  field(:loanInterestRate)
  field(:rebateValue, as: GoogleApi.Solar.V1.Model.Money)
  field(:savings, as: GoogleApi.Solar.V1.Model.SavingsOverTime)
end

defimpl Poison.Decoder, for: GoogleApi.Solar.V1.Model.FinancedPurchaseSavings do
  def decode(value, options) do
    GoogleApi.Solar.V1.Model.FinancedPurchaseSavings.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Solar.V1.Model.FinancedPurchaseSavings do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
